/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

/**
 * <p>Project: jse2302 - For1
 * <p>Powered by webrx On 2023-06-12 16:23:34
 * <p>Created by IntelliJ IDEA
 *
 * @author  webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class For3 {
    public static void main(String[] args) {
        //条件为true进入循环，为false结束循环语句
        //for (int i = 1; i < 15; i++) {
        //    i = 2;
        //    System.out.println(i);
        //}

        //计算1+2+3+...+100 = ?
        long ss = System.currentTimeMillis();
        int sum = 0;
        for (int i = 1; i <= 100; i++) {
            //sum +=i;
            sum = sum+i;
        }
        System.out.println("1+2+3+...+100 = " + sum);
        long ee = System.currentTimeMillis();
        System.out.printf("用时%dms",ee-ss);
    }
}

//3 6 9 12 15
